<?php

namespace Drinkiit\BlogBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class AdminOperationsCommandeType extends AbstractType
{
	private $em ;
	
	public function __construct(EntityManager $em)
	{
		$this->em = $em ;
	}
	
    public function buildForm(FormBuilder $builder, array $options)
    {
		$choices = $this->em->getRepository('DrinkiitBlogBundle:Commande')->findBy( array('validee' => true, 'est_payee' => false, 'est_menu' => false)) ;
		
        $builder
            ->add('operation_commande', NULL, array( 'label' => 'Si concerne une commande', 'choices' => $choices) )
        ;
    }

    public function getName()
    {
        return 'admin_management_operations';
    }
}
